class Solution {
public:
    bool hasSameDigits(string s) {
        if (s.size() < 2) return false;
        if (s.size() == 2) {
            return s[0] == s[1];
        }
        string temp;
        for (int i = 0, j = 1; j < s.size(); i++, j++) {
            int val = ((s[i] - '0') + (s[j] - '0')) % 10;
            temp += (val + '0');
        }
        return hasSameDigits(temp);
    }
};
